<template>
    <div class="container">
        <mt-header title="秒杀记录">
            <router-link to="" slot="left">
                <mt-button icon="back" @click.native="$router.back(-1)">返回</mt-button>
            </router-link>
        </mt-header>
        <div class="eventlist" v-if="orderList.length>0">
            <div class="row" v-for="(order,i) in orderList" v-bind:key="i" @click="bindToDetail(order.cid)">
                <div class="row-span">
                    <span class="event-title">
                        {{order.cname}}
                    </span>
                    <span class="event-date">{{order.ctime}}</span>
                </div>
                <div class=" point event-point">

                </div>
            </div>

        </div>
        <Nothing v-else></Nothing>
    </div>
</template>

<script>
    import Nothing from "../../../components/Nothing"

    export default {
        name: "MyOrders",
        components: { Nothing },
        data() {
            return {
                orderList: [],
                uid: this.$store.getters.getUserInfo.uid
            }
        },
        mounted() {
            this.getMyOrders()
        },
        methods: {
            getMyOrders() {
                this.$axios( {
                    method: 'post',
                    url: 'Index/listqiang',
                    data: {
                        uid: this.uid
                    }
                } ).then( result => {
                    this.orderList = result.data
                } ).catch( error => {

                } );
            },

            bindToDetail(id) {
                this.$router.push( '/product/' +id )
            }
        },
    }
</script>

<style scoped>
    .container {
        padding: 0;
        background-image: url("../../../../static/images/background.jpg");
        background-size: 100% 100%;
    }

    .eventlist {
        margin: 2vh;
        margin-top: 0;
        display: flex;
        flex-direction: column;
        background-color: #fff;
        padding: 2vh 20px;
        min-height: 92vh;
    }

    .eventlist .row {
        display: flex;
        flex-direction: row;
        padding: 16px 24px;
        border-top: 1px solid rgba(229, 229, 229, 1);
    }

    .eventlist .row:first-child {
        border-top: none;
    }

    .eventlist .row .row-span {
        display: flex;
        flex-direction: column;
        width: 500px;
    }

    .eventlist .event-title {
        font-size: 26px;
        font-weight: 800;
    }

    .eventlist .event-date {
        margin-top: 8px;
        color: rgba(119, 119, 119, 1);
        font-size: 22px;
        span-align: left;
    }

    .event-point .point-icon {
        width: 30px;
        height: 30px;
        margin-top: 23px;
        margin-right: 20px;
    }

    .eventlist .event-point {
        width: 160px;
        height: 76px;
        line-height: 76px;
        span-align: left;
        color: #fc5a5a;
        font-weight: 800;
        font-size: 32px;
    }
</style>
